home *** CD-ROM | disk | FTP | other *** search
/ Champak 120 / Vol 120.iso / games / anacroz.swf / scripts / __Packages / Soldado.as < prev    next >
Encoding:
Text File  |  2010-11-09  |  5.2 KB  |  271 lines

  1. class Soldado extends Sprite
  2. {
  3.    var nivel;
  4.    var EXP;
  5.    var lider;
  6.    var status;
  7.    var itens;
  8.    var magias;
  9.    var flecha;
  10.    var deslocamento;
  11.    var mododesejado;
  12.    var nome;
  13.    var classe;
  14.    var tropa;
  15.    var modo;
  16.    var custo;
  17.    var alcance;
  18.    var PV;
  19.    var PM;
  20.    var maxPV;
  21.    var maxPM;
  22.    var ATQ;
  23.    var DEF;
  24.    var AGL;
  25.    var INT;
  26.    var MRL;
  27.    var dano;
  28.    var defesa;
  29.    function Soldado()
  30.    {
  31.       super();
  32.       this.nivel = 1;
  33.       this.EXP = 0;
  34.       this.lider = false;
  35.       this.status = true;
  36.       this.itens = new Array();
  37.       this.magias = new Array();
  38.       this.flecha = 14;
  39.       this.deslocamento = 0;
  40.       this.mododesejado = 0;
  41.    }
  42.    function isLeader()
  43.    {
  44.       return this.lider;
  45.    }
  46.    function setNome(nome)
  47.    {
  48.       this.nome = nome;
  49.    }
  50.    function setClasse(classe)
  51.    {
  52.       this.classe = classe;
  53.    }
  54.    function setTropa(tropa)
  55.    {
  56.       this.tropa = tropa;
  57.    }
  58.    function setModo(modo)
  59.    {
  60.       this.modo = modo;
  61.    }
  62.    function setCusto(c)
  63.    {
  64.       this.custo = c;
  65.    }
  66.    function setAlcance(al)
  67.    {
  68.       this.alcance = al;
  69.    }
  70.    function setNivel(nivel)
  71.    {
  72.       this.nivel = nivel;
  73.    }
  74.    function setEXP(EXP)
  75.    {
  76.       this.EXP = EXP;
  77.    }
  78.    function setPV(pv)
  79.    {
  80.       this.PV = pv >= 0 ? pv : 0;
  81.    }
  82.    function setPM(pm)
  83.    {
  84.       this.PM = pm;
  85.    }
  86.    function setMaxPV(pv)
  87.    {
  88.       this.maxPV = pv;
  89.    }
  90.    function setMaxPM(pm)
  91.    {
  92.       this.maxPM = pm;
  93.    }
  94.    function setATQ(atq)
  95.    {
  96.       this.ATQ = atq;
  97.    }
  98.    function setDEF(def)
  99.    {
  100.       this.DEF = def;
  101.    }
  102.    function setAGL(agl)
  103.    {
  104.       this.AGL = agl;
  105.    }
  106.    function setINT(int)
  107.    {
  108.       this.INT = int;
  109.    }
  110.    function setMRL(mrl)
  111.    {
  112.       this.MRL = mrl;
  113.    }
  114.    function setDano(dano)
  115.    {
  116.       this.dano = dano;
  117.    }
  118.    function setDefesa(def)
  119.    {
  120.       this.defesa = def;
  121.    }
  122.    function getNome()
  123.    {
  124.       return this.nome;
  125.    }
  126.    function getClasse()
  127.    {
  128.       return this.classe;
  129.    }
  130.    function getTropa()
  131.    {
  132.       return this.tropa;
  133.    }
  134.    function getModo()
  135.    {
  136.       return this.modo;
  137.    }
  138.    function getCusto()
  139.    {
  140.       return this.custo;
  141.    }
  142.    function getAlcance()
  143.    {
  144.       return this.alcance;
  145.    }
  146.    function getNivel()
  147.    {
  148.       return this.nivel;
  149.    }
  150.    function getEXP()
  151.    {
  152.       return this.EXP;
  153.    }
  154.    function getMaxPV()
  155.    {
  156.       return this.maxPV;
  157.    }
  158.    function getMaxPM()
  159.    {
  160.       return this.maxPM;
  161.    }
  162.    function getPV()
  163.    {
  164.       return this.PV;
  165.    }
  166.    function getPM()
  167.    {
  168.       return this.PM;
  169.    }
  170.    function getATQ()
  171.    {
  172.       return this.ATQ;
  173.    }
  174.    function getDEF()
  175.    {
  176.       return this.DEF;
  177.    }
  178.    function getAGL()
  179.    {
  180.       return this.AGL;
  181.    }
  182.    function getINT()
  183.    {
  184.       return this.INT;
  185.    }
  186.    function getMRL()
  187.    {
  188.       return this.MRL;
  189.    }
  190.    function getDano()
  191.    {
  192.       return this.dano;
  193.    }
  194.    function getDefesa()
  195.    {
  196.       return this.defesa;
  197.    }
  198.    function addNivel(n)
  199.    {
  200.       this.nivel += n;
  201.       this.maxPV += 30 * n;
  202.       this.maxPM += this.maxPM <= 0 ? 0 : 10 * n;
  203.       this.PV = this.maxPV;
  204.       this.PM = this.maxPM;
  205.       this.ATQ += 3 * n;
  206.       this.DEF += 2 * n;
  207.       this.AGL += 1 * n;
  208.       this.INT += this.INT <= 0 ? 0 : 2 * n;
  209.       this.MRL += n;
  210.       this.custo *= n + 1;
  211.    }
  212.    function addItem(x)
  213.    {
  214.       var _loc3_ = 1;
  215.       this.itens.push(_root.createItem(x));
  216.       this.itens.sortOn(["valor","tipo"],Array.RETURNINDEXEDARRAY);
  217.       while(_loc3_ < 6)
  218.       {
  219.          if(this.itens[_loc3_ - 1])
  220.          {
  221.             if(this.itens[_loc3_ - 1].isEquiped())
  222.             {
  223.                _root["item" + _loc3_].equip.gotoAndStop(2);
  224.             }
  225.             else
  226.             {
  227.                _root["item" + _loc3_].equip.gotoAndStop(1);
  228.             }
  229.             _root["item" + _loc3_].item.gotoAndStop(this.itens[_loc3_ - 1].getCod() + 2);
  230.             _root["item" + _loc3_].item.useHandCursor = true;
  231.          }
  232.          else
  233.          {
  234.             _root["item" + _loc3_].item.useHandCursor = false;
  235.             _root["item" + _loc3_].item.gotoAndStop(1);
  236.             _root["item" + _loc3_].equip.gotoAndStop(1);
  237.          }
  238.          _loc3_ = _loc3_ + 1;
  239.       }
  240.    }
  241.    function removeItem(x)
  242.    {
  243.       var _loc3_ = 1;
  244.       this.itens.splice(x,1);
  245.       this.itens.sortOn(["valor","tipo"],Array.RETURNINDEXEDARRAY);
  246.       while(_loc3_ < 6)
  247.       {
  248.          if(this.itens[_loc3_ - 1])
  249.          {
  250.             if(this.itens[_loc3_ - 1].isEquiped())
  251.             {
  252.                _root["item" + _loc3_].equip.gotoAndStop(2);
  253.             }
  254.             else
  255.             {
  256.                _root["item" + _loc3_].equip.gotoAndStop(1);
  257.             }
  258.             _root["item" + _loc3_].item.gotoAndStop(this.itens[_loc3_ - 1].getCod() + 2);
  259.             _root["item" + _loc3_].item.useHandCursor = true;
  260.          }
  261.          else
  262.          {
  263.             _root["item" + _loc3_].item.useHandCursor = false;
  264.             _root["item" + _loc3_].item.gotoAndStop(1);
  265.             _root["item" + _loc3_].equip.gotoAndStop(1);
  266.          }
  267.          _loc3_ = _loc3_ + 1;
  268.       }
  269.    }
  270. }
  271.